﻿<%@ Page Title="Manage Client" Language="C#" MasterPageFile="~/MasterPage.master"
    AutoEventWireup="true" CodeFile="Mng_Client.aspx.cs" Inherits="admin_Mng_Client" %>

<asp:Content ID="Head" ContentPlaceHolderID="head" runat="Server">
    <link href="../styles/admin.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
     <div id="top_menu">
        <div id="help_button">
            help
        </div>
             <div id="logout">
            <asp:LoginStatus ID="LoginStatus1" runat="server" LogoutPageUrl="../Default.aspx"
                OnLoggingOut="LoginStatus1_LoggingOut" />
        </div>
    </div>
    <div id="page_title">
        ADMINISTRATION
    </div>
    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    <div id="left_content">
        <div class="menu">
            <ul>
                <li><a href="Home.aspx">Home</a></li>
                <li><a href="#" class="current">Manage Clients</a></li>
                <li><a href="Mng_Site.aspx">Manage Sites</a></li>
                <li><a href="Mng_Machine.aspx">Manage Machines</a></li>
                <li><a href="Mng_Comp.aspx">Manage Components</a></li>
                <li><a href="Mng_Report.aspx">Manage Reports</a></li>
                <li><a href="Mng_WO.aspx">Manage Work Order</a></li>
                <li><a href="Mng_FaultsRecom.aspx">Manage Faults Recommendation</a></li>
            </ul>
        </div>
    </div>
    <!-- end of left content -->
    <div id="right_content">
        <div class="content_area">
            <h2>
                Manage Clients
            </h2>
            <div class="form_box">
                <asp:GridView ID="GridViewClient" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                    DataSourceID="ClientObjectDataSource" DataKeyNames="client_id" OnSelectedIndexChanged="GridViewClient_SelectedIndexChanged"
                    CssClass="column" PageSize="20" OnDataBound="GridViewClient_DataBound">
                    <Columns>
                        <asp:TemplateField ShowHeader="false" Visible="false">
                            <ItemTemplate>
                                <asp:Label ID="parent_idLabel" runat="server" Text='<%# Bind("parent_client_id") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="clientName" HeaderText="Client Name" SortExpression="clientName"
                            ItemStyle-CssClass="column">
                            <ItemStyle CssClass="column" />
                        </asp:BoundField>
                        <asp:TemplateField HeaderText="Parent" SortExpression="parentName">
                            <ItemTemplate>
                                <asp:Label ID="parentNameLabel" runat="server"></asp:Label>
                            </ItemTemplate>
                            <ItemStyle CssClass="column" />
                        </asp:TemplateField>
                        <asp:BoundField DataField="status" HeaderText="Status" SortExpression="status">
                            <ItemStyle CssClass="column" />
                        </asp:BoundField>
                        <asp:CommandField SelectText="Details..." ShowSelectButton="True">
                            <ItemStyle CssClass="column" />
                        </asp:CommandField>
                    </Columns>
                    <PagerStyle CssClass="pager" />
                    <HeaderStyle CssClass="header" />
                </asp:GridView>
                <%--<asp:ObjectDataSource ID="ClientObjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
                    SelectMethod="GetData" TypeName="DataAccess.i2iPortalTableAdapters.ClientsTableAdapter">
                </asp:ObjectDataSource>--%>
                <asp:ObjectDataSource ID="ClientObjectDataSource" runat="server" 
                    DeleteMethod="Delete" InsertMethod="Insert" 
                    OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" 
                    TypeName="DataAccess.i2iPortalTableAdapters.ClientsTableAdapter" 
                    UpdateMethod="Update">
                    <DeleteParameters>
                        <asp:Parameter Name="Original_client_id" Type="Int32" />
                    </DeleteParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="clientName" Type="String" />
                        <asp:Parameter Name="address" Type="String" />
                        <asp:Parameter Name="contactPerson" Type="String" />
                        <asp:Parameter Name="phoneMobile" Type="String" />
                        <asp:Parameter Name="phoneWork" Type="String" />
                        <asp:Parameter Name="fax" Type="String" />
                        <asp:Parameter Name="email" Type="String" />
                        <asp:Parameter Name="distributionEmail" Type="String" />
                        <asp:Parameter Name="status" Type="String" />
                        <asp:Parameter Name="parent_client_id" Type="Int32" />
                        <asp:Parameter Name="paid_status" Type="String" />
                        <asp:Parameter Name="date_registered" Type="DateTime" />
                        <asp:Parameter Name="licenced_start" Type="String" />
                        <asp:Parameter Name="licenced_expired" Type="DateTime" />
                         <asp:Parameter Name="service_type" Type = "String" />
                        <asp:Parameter Name="Original_client_id" Type="Int32" />
                    </UpdateParameters>
                     <InsertParameters>
                        <asp:Parameter Name="client_id" Type="Int32" />
                        <asp:Parameter Name="clientName" Type="String" />
                        <asp:Parameter Name="address" Type="String" />
                        <asp:Parameter Name="contactPerson" Type="String" />
                        <asp:Parameter Name="phoneMobile" Type="String" />
                        <asp:Parameter Name="phoneWork" Type="String" />
                        <asp:Parameter Name="fax" Type="String" />
                        <asp:Parameter Name="email" Type="String" />
                        <asp:Parameter Name="distributionEmail" Type="String" />
                        <asp:Parameter Name="status" Type="String" />
                        <asp:Parameter Name="parent_client_id" Type="Int32" />
                        <asp:Parameter Name="paid_status" Type="String" />
                        <asp:Parameter Name="date_registered" Type="DateTime" />
                        <asp:Parameter Name="licenced_start" Type="String" />
                        <asp:Parameter Name="licenced_expired" Type="DateTime" />
                        <asp:Parameter Name="service_type" Type = "String" />
                    </InsertParameters>
                </asp:ObjectDataSource>
                <br />
                <asp:Button ID="CreateClient" runat="server" Text="Add New Client" OnClick="CreateClient_Click"
                    CssClass="buttons" />
            </div>
        </div>
        </div>
        <!-- end of right content -->
</asp:Content>
